from openpyxl import Workbook
print("=====================================================demo======================")
name_age = {
    "a":1,
    "b":2,
    "c":3,
    "d":4,
    "e":5,
    "f":6,
    "g":7,
}

wb2 = Workbook();
sheetobj2 = wb2.active
sheetobj2.title = "姓名-成绩表"
sheetobj2.cell(row=1,column=1).value = "name"
sheetobj2.cell(row=1,column=2).value = "age"
for index, (key, value) in enumerate(name_age.items()):
    sheetobj2.cell(index+2,1).value = key
    sheetobj2.cell(index + 2, 2).value = value

wb2.save('test2.xlsx')